﻿
function gosubmit() {
    var ret = false;
    if (checkDomain()) {
        if (document.getElementById("pwd").value != document.getElementById("spwd").value) {
            document.getElementById("error").innerHTML = "两次密码输入不一致";
        } else {
            ret = true;
        }
    }
    return ret;
}

function checkDomain() {
    var domain = document.getElementById("uname").value.replace("http://", "").replace("www.", "");
    if (domain == "") {
        var domain = document.getElementById("uname").value = "如:blogdh.com";
        document.getElementById("error").innerHTML = "请输入域名";
        return false;
    } else if (domain == "如:blogdh.com") {
        document.getElementById("error").innerHTML = "请输入域名";
        return false;
    }
    document.getElementById("uname").value = domain;
    var patrn = /^[0-9a-zA-Z]+[0-9a-zA-Z\.-]*\.[a-zA-Z]{2,4}$/;
    if (patrn.test(domain)) {
        return true;
    } else {
        document.getElementById("error").innerHTML = "域名格式输入错误";
        return false;
    }
}